home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CUJ9209.ARJ / 1009047B < prev    next >
Text File  |  1992-04-03  |  695b  |  32 lines

  1. /***                LISTING 5                 ***/
  2. /***                                          ***/
  3. /***                  sin.c                   ***/
  4. /*** **************************************** ***/
  5. /***    INPUT A CHARACTER FROM SERIAL PORT    ***/
  6. /*** **************************************** ***/
  7. #include "serial.h"
  8. #include <time.h>
  9.  
  10. extern int portbase;
  11.  
  12. int SerialIn()
  13.   {
  14.    int Char_Value;
  15.    clock_t start, timeout;
  16.  
  17.    start = clock();
  18.  
  19.    while((inp(portbase + LSR) & RCVRDY) == 0)
  20.     {
  21.      timeout = clock();
  22.  
  23.      if((timeout-start) > 1)
  24.       {
  25.        return(-1);
  26.       }
  27.     }
  28.  
  29.   Char_Value = inp(portbase + RXR);
  30.   return (Char_Value);
  31. }
  32.